<?php

namespace app\admin\model;

use think\Model;

class MemberAddress extends Model
{
    private static $instance = null;

    public static function getInstance()
    {
        //检测当前类属性$instance是否已经保存了当前类的实例
        if (self::$instance == null) {
            //如果没有,则创建当前类的实例
            self::$instance = new self();
        }
        //如果已经有了当前类实例,就直接返回,不要重复创建类实例
        return self::$instance;
    }

    public function getNames($coin_id)
    {
        return $this->field('name')->where(array('id' => $coin_id))->find();
    }

    public function getOne($where, $field = '*', $order = '')
    {
        return $this->field($field)->where($where)->order($order)->find();
    }

    public function addressList($where)
    {
        return $this->where($where)
            ->order('id', 'desc')
            ->column("address");
    }
}
